package com.ybkj.chat.module.main.fragment;

import android.support.v7.widget.GridLayoutManager;
import android.view.View;
import android.widget.ImageView;

import com.ybkj.chat.R;
import com.ybkj.chat.base.BaseMvpFragment;
import com.ybkj.chat.manager.ActivityManager;
import com.ybkj.chat.module.main.activity.PeopleNearbyActivity;
import com.ybkj.chat.module.main.activity.RecomTopicActivity;
import com.ybkj.chat.module.main.activity.StrangerDynamicsActivity;
import com.ybkj.chat.ui.adapter.RecommendAdapter;
import com.ybkj.chat.ui.view.recyclerview.XRecyclerView;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 圈子
 */
public class MainFragment extends BaseMvpFragment {
    //搜索
    @BindView(R.id.iv_search)
    ImageView ivSearch;
    //编辑
    @BindView(R.id.et_edit)
    ImageView etEdit;
    //为你推荐列表
    @BindView(R.id.recommend_recycle)
    XRecyclerView recommendRecycle;
    private RecommendAdapter recommendAdapter;


    @Override
    protected void injectPresenter() {

    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        recommendAdapter = new RecommendAdapter(mContext);
        recommendRecycle.setLayoutManager(new GridLayoutManager(mContext, 3));
        recommendAdapter.bindToRecyclerView(recommendRecycle);
        recommendAdapter.addData("1");
        recommendAdapter.addData("1");
        recommendAdapter.addData("1");
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_main;
    }

    @Override
    protected String getSimpleNme() {
        return null;
    }

    /**
     * 点击事件业务
     *
     * @param view
     */
    @OnClick({R.id.iv_search, R.id.People_nearby, R.id.recommended_layout, R.id.stranger_layout})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            //搜索
            case R.id.iv_search:
                break;
            //附近的人
            case R.id.People_nearby:
                ActivityManager.gotoActivity(mContext, PeopleNearbyActivity.class);
                break;
            //推荐话题
            case R.id.recommended_layout:
                ActivityManager.gotoActivity(mContext, RecomTopicActivity.class);
                break;
            //附近陌生人动态
            case R.id.stranger_layout:
                ActivityManager.gotoActivity(mContext, StrangerDynamicsActivity.class);
                break;
        }
    }
}
